package com.example.shiyan3;

import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class zidongbofang extends AppCompatActivity {
    Button Ret;     //声明返回控件

    private ImageView mImg;
    private AnimationDrawable mAd;
    private MusicServer music;


    //点击想要进入的页面后自动播放音乐
    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        music.stop(this);
    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        music.play(this, R.raw.my_music);
    }

    //自动播放图片集
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.zidongbofang);
        mImg = findViewById(R.id.imageView1);
        mImg.setBackgroundResource(R.drawable.tupianzidong);
        mAd = (AnimationDrawable) zidongbofang.this.mImg.getBackground();
        mAd.start();

        //返回主页控件
        Ret=findViewById(R.id.ret);
        Ret.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(zidongbofang.this,MainActivity.class);
                startActivity(intent);
            }
        });
    }
}
